﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace WPFDemo.ViewModel
{
    public class TreeViewViewModel
    {
        private TreeViewModel _treeViewModel =new TreeViewModel();
        public TreeViewModel TreeViewModel { 
            get { return _treeViewModel; } 
            set { _treeViewModel = value; }
        }   

        public TreeViewViewModel()
        {
            InitTree();
        }

        public void InitTree()
        {
            for (int i=0;i<5;i++)
            {
                TreeViewModel treeViewModel = new TreeViewModel();
                treeViewModel.Name = $"第{i + 1}级";
                for (int j=0;j<5;j++)
                {
                    TreeViewModel treeViewModel1=new TreeViewModel();
                    treeViewModel1.Name = $"第{i + 1}----{j + 1}级";
                    treeViewModel.Children.Add(treeViewModel1);
                }
                TreeViewModel.Children.Add(treeViewModel);
            }
        }


    }
}
